--[[
    房间实体
]]--

local blaze = require "blaze"
local game = require "club.threecard.texas"
local Room = require "entities.Room"
local log = blaze.logging.get("TexaspokerRoom")

local M = game.kbe.entity("TexaspokerRoom", Room)

function M:__init__()
    Room.__init__(self)
end

--[[ =============================
             服务端接口
================================== ]]--


--[[ =============================
             服务端回调
================================== ]]--

function M:set_current_bonus(old)
    log.debug(string.format("set_current_bonus:%s", self.current_bonus))
    game.store.ingame.on_current_bonud(self.current_bonus)
end

function M:on_phase(phase_id, countdown)
    log.debug(string.format("进入阶段:id=%s coundown=%s", phase_id, countdown))
    local args = {
        phase_id = phase_id,
        countdown = countdown
    }
    game.store.ingame.on_phase(args)
end

function M:on_notice_button(button_no, s_blind_no, l_blind_no)
    log.debug("on_notice_button")
    local args = {
        button_no = button_no,
        s_blind_no = s_blind_no, 
        l_blind_no= l_blind_no
    }
    game.store.ingame.on_notice_button(args)
end

function M:on_notice_blind(s_blind_value, l_blind_value)
    log.debug(string.format("on_notice_blind 大盲=%s 小盲=%s", s_blind_value, l_blind_value))
    local args = {
        s_blind_value = s_blind_value,
        l_blind_value = l_blind_value
    }
    game.store.ingame.on_notice_blind(args)
end

function M:on_notice_burn(count)
    log.debug(string.format("on_notice_burn: 池底=%s", count))
    game.store.ingame.on_notice_burn(count)
end

function M:on_notice_deal(card_ids)
    log.debug(string.format("发牌:%s", blaze.dump(card_ids)))
    game.store.ingame.on_notice_deal(card_ids)
end

function M:on_turn_ope(no, operations, time)
    log.debug(string.format("请求玩家操作:座位=%s %s 时间=%s", no, game.dump(operations), time))
    local args = {
        no = no,
        operation_ids = operations.operation_ids,
        operation_values = operations.operation_values,
        time = time
    }
    game.store.ingame.on_turn_ope(args)
end

function M:on_player_ope(no, operation_id, value)
    log.debug(string.format("玩家操作:座位=%s op=%s value=%s", no, operation_id, value))
    local args = {
        no = no,
        operation_id = operation_id,
        value = value
    }
    game.store.ingame.on_player_ope(args)
end

function M:on_showdown(showdown_info)
    log.debug("亮牌:".. blaze.dump(showdown_info))
    game.store.ingame.on_showdown(showdown_info)
end

function M:on_settle(settle_info)
    log.debug("结算:".. blaze.dump(settle_info))
    game.store.ingame.on_settle(settle_info)
end

return M